package org.simplespringframework.mvc.type;

import lombok.Data;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * @BelongsProject: simpleframework
 * @BelongsPackage: org.simplespringframework.mvc.type
 * @Author: xshang
 * @CreateTime: 2023-06-29  15:11
 * @Description: 存储处理完后的结果数据，以及显示该数据的试图
 * @Version: 1.0
 */

public class ModelAndView {

    // 页面所在路径
    @Getter
    private String view;

    // 页面的data数据
    @Getter
    private final Map<String, Object> model = new HashMap<String, Object>();

    public ModelAndView setView(String view) {
        this.view = view;
        return this;
    }

    public ModelAndView addViewData(String attributeName, Object attributeValue) {
        model.put(attributeName, attributeValue);
        return this;
    }

}
